{% extends "member/member_base.html" %}
{% block style %}
    [name='content']:{
        width: 100%,
        height: 500px;

    }
{% endblock %}

		{% block content %}
		{{ dropzone.load_css() }}
        {{ dropzone.load_js() }}
		<div class="container-fluid">
			<div class="row">
				
				<div class="main col-md-12 col-lg-12 col-xs-12 col-sm-12" >

						<h3>文章发布</h3>
                       <div class="alert alert-info" id="message" role="alert">

                        </div>
						 <div class="body">

                            {%  for field in form %}

                                {% if field.widget.input_type!="hidden" %}
                                        <div class="form-group">
                                            {{ field.label }}
                                            {{ field }}
                                        </div>
                                    {% else %}
                                        {{ field }}
                                        {% if field.name=="thumb" %}
                                            {{ dropzone.create(action="upload.ckeditor_upload") }}
                                        {% endif %}
                                    {% endif %}
                            {% endfor %}

							<div class="form-group">
							<input class="btn" type="button" name="btn" id="btn1" value="发表文章" />
							<input class="btn" type="reset" name="reset_btn" id="btn2" value="重设" />
							</div>

						 </div>

				</div>
			</div>
		</div>
{#            这里一定要将后台的上传视图返回的数据使用flask.jsonify处理 #}
             {{   dropzone.config(
                        custom_init='this.on("success", function(file, res) {
                        if( file.xhr.status == 200 ){
                           $("#thumb").val(res.url)
                           console.log(res)
                        }else{
                            alert("上传失败");
                        }
                         });'
                    )
             }}
            <script src="{{ url_for('static', filename="ckeditor/ckeditor.js") }}"></script>
            <script>
               upload_url = "{{ url_for("upload.ckeditor_upload") }}"
               browser_url = "{{ url_for("upload.ckeditor_browser") }}"
               csrf_token = "{{ csrf_token() }}"
            </script>
            <script src="{{ url_for("static",filename="js/article/ckeditor_settings.js") }}"></script>
            <script src="{{ url_for("static",filename="js/article/post.js") }}"></script>
	{%  endblock %}
